package com.inspur.system.utils;

import com.inspur.common.utils.SecurityUtils;
import com.inspur.system.domain.PmDyn;
import org.springframework.stereotype.Component;

@Component
public class PmDynUtils
{
    public static PmDyn addDynCom(String cDynCom, String type, String cPmNo) {
        PmDyn pmDyn = new PmDyn();
        pmDyn.setcDynType(type);
        pmDyn.setcDynCom(cDynCom);
        pmDyn.setcCrePer(SecurityUtils.getUserId()+"");
        pmDyn.setcPmNo(cPmNo);
        return pmDyn;
    }

    public static String updateState (String oldState, String state) {
        if ("1".equals(oldState)) {
            oldState = "未开始";
        } else if ("2".equals(oldState)) {
            oldState = "进行中";
        } else if ("3".equals(oldState)) {
            oldState = "开发完成";
        } else if ("4".equals(oldState)) {
            oldState = "测试完成";
        } else if ("5".equals(oldState)) {
            oldState = "已上线";
        } else if ("0".equals(oldState)) {
            oldState = "null";
        }
        if ("1".equals(state)) {
            state = "未开始";
        } else if ("2".equals(state)) {
            state = "进行中";
        } else if ("3".equals(state)) {
            state = "开发完成";
        } else if ("4".equals(state)) {
            state = "测试完成";
        } else if ("5".equals(state)) {
            state = "已上线";
        }
        return "工作项状态由：" + oldState + "改为：" + state;
    }
}
